package com.guohe3.just.controller;

import com.guohe3.just.common.resp.ApiResult;
import com.guohe3.just.common.utils.RestUtil;
import com.guohe3.just.service.LibrarayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "图书馆接口", description = "图书馆接口")
@RestController
@RequestMapping("api/book")
public class LibraryController {
    @Autowired
    private LibrarayService librarayService;
    @PostMapping("/getBookRank")
    @ApiOperation("获取图书馆排名")
    public ApiResult create(@RequestParam String password) throws Exception {
        if (password.equals("guohe"))
        return RestUtil.success("查询成功",librarayService.GetLibToplist());
        else return RestUtil.error(-1,"非法查询");
    }
}
